package com.company.wushuo.justfortest.reactive;

/**
 * 观察者的原始接口
 *
 * Calling the Observer's method must happen in a serialized fashion, that is, they must not be invoked concurrently by multiple threads in an overlapping fashion and the invocation pattern must adhere to the following protocol:
 onSubscribe onNext* (onError | onComplete)?
 Subscribing an Observer to multiple ObservableSources is not recommended.
 If such reuse happens, it is the duty of the Observer implementation to be ready to receive multiple calls to its methods and ensure proper concurrent behavior of its business logic.


 这些回调的顺序是有顺序的，多线程之间是同步的
 * Created by wushuo on 2021/4/3.
 */

public interface Observer<T> {

    /**
     * 接受一个值
     */
    void onNext(T value);

    /**
     * 接受一个错误
     */
    void onError(Throwable throwable);

    /**
     * 接受完成
     */
    void onComplete();

}
